﻿namespace PmfWeb.Core.Attributes
{
    ///<summary>
    /// 特性助手
    ///</summary>
    public class AttributeHelper
    {
        ///<summary>
        /// 获取指定类型的特性
        ///</summary>
        ///<typeparam name="T">特性类型</typeparam>
        ///<typeparam name="K">要获取的对象类型</typeparam>
        ///<returns>设置在该对象类型上的特性</returns>
        public static T GetAttribute<T, K>() where T : System.Attribute
        {
            return System.Attribute.GetCustomAttribute(typeof(K), typeof (T)) as T;
        }
    }
}
